package janelas;

import outros.CampoMask;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.util.ArrayList;
import javax.swing.JOptionPane;
import javax.swing.text.MaskFormatter;
import outros.Documento;
import outros.GeradorRelatorio;
import outros.Util;
import persistencia.DAOGenerico;
import persistencia.DAOPatrimonio;
import persistencia.DAOSetor;
import persistencia.DAOUsuario;
import transporte.TOGenerico;
import transporte.TOPatrimonio;
import transporte.TOSetor;
import transporte.TOUsuario;

public class RelatorioEmp extends javax.swing.JInternalFrame implements JanelaPai {
    //DAO's
    private DAOUsuario daoUsuario = new DAOUsuario();
    private DAOSetor daoSetor = new DAOSetor();
    private DAOGenerico daoOrgao = new DAOGenerico();
    private DAOPatrimonio daoPatrimonio = new DAOPatrimonio();
    //TO's
    private ArrayList<TOUsuario> toUsuario = new ArrayList();
    private ArrayList<TOSetor> toSetor = new ArrayList();
    private ArrayList<TOGenerico> toOrgao = new ArrayList();
    private TOPatrimonio patrimonio = new TOPatrimonio();
    //Outros
    private Util util = new Util();
    private GeradorRelatorio gr = new GeradorRelatorio();

    public RelatorioEmp() {
        initComponents();
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-getWidth())/2, (int)((screenSize.height-getHeight())/3), getWidth(), getHeight());
        toOrgao = daoOrgao.selecionarGenerico("orgao", "nome");
        for (int i=0;i<toOrgao.size();i+=1) {
            camOrgao.addItem(toOrgao.get(i).getNome());
        }
    }

    public void reiniciar() {
        preencherCombobox();
    }

    public void limparCampos() {
        checkUsuario.setSelected(false);
        checkData.setSelected(false);
        checkPatrimonio.setSelected(false);
        checkSetorResp.setSelected(false);
        checkTipo.setSelected(false);
        checkTipoEmp.setSelected(false);
        camUsuario.setEnabled(false);
        camDataInicial.setEnabled(false);
        camDataFinal.setEnabled(false);
        camOrgao.setEnabled(false);
        camBuscaArea.setEnabled(false);
        camBuscaGrupo.setEnabled(false);
        camBuscaSubgrupo.setEnabled(false);
        camBuscaNumero.setEnabled(false);
        camSetorResp.setEnabled(false);
        camTipo.setEnabled(false);
        camTipoEmp.setEnabled(false);
        botBuscar.setEnabled(false);
    }

    public void preencherCombobox() {
        camUsuario.removeAllItems();
        camSetorResp.removeAllItems();
        toUsuario = daoUsuario.selecionar("");
        toSetor = daoSetor.selecionar("");
        for (int i=0;i<toUsuario.size();i+=1) {
            camUsuario.addItem(toUsuario.get(i).getNome());
        }
        for (int i=0;i<toSetor.size();i+=1) {
            camSetorResp.addItem(toSetor.get(i).getNome());
        }
        limparCampos();
    }

    private int[] verificarCampos() {
        int[] valores = new int[5];
        if (camBuscaArea.getText().length()>0) {
            valores[0] = Integer.parseInt(camBuscaArea.getText());
        } else {
            valores[0] = -1;
        }
        if (camBuscaGrupo.getText().length()>0) {
            valores[1] = Integer.parseInt(camBuscaGrupo.getText());
        } else {
            valores[1] = -1;
        }
        if (camBuscaSubgrupo.getText().length()>0) {
            valores[2] = Integer.parseInt(camBuscaSubgrupo.getText());
        } else {
            valores[2] = -1;
        }
        if (camBuscaNumero.getText().length()>0) {
            valores[3] = Integer.parseInt(camBuscaNumero.getText());
        } else {
            valores[3] = -1;
        }
        valores[4] = toOrgao.get(camOrgao.getSelectedIndex()).getNumero();
        return valores;
    }

    private void buscarPatrimonio() {
        int[] valores = verificarCampos();
        for (int i=0;i<valores.length;i+=1) {
            if (valores[i]==-1) {
                JOptionPane.showMessageDialog(null, "Preencha todos os campos.");
                return;
            }
        }
        patrimonio = daoPatrimonio.selecionarRegistro(valores[0], valores[1], valores[2], valores[3], valores[4], -1);
        if (patrimonio!=null) {
            camPatrimonio.setText(patrimonio.getNome());
        } else {
            JOptionPane.showMessageDialog(null, "Não foi possível encontrar nenhum patrimônio.");
            camPatrimonio.setText("");
        }
    }

    private ArrayList<String> getCondicoes() {
        ArrayList<String> cond = new ArrayList();
        if (checkUsuario.isSelected()) {
            cond.add("patri_reg_emprestimo.usuario="+toUsuario.get(camUsuario.getSelectedIndex()).getNumero());
        }
        if (checkSetorResp.isSelected()) {
            cond.add("patri_reg_emprestimo.setor_responsavel="+toSetor.get(camSetorResp.getSelectedIndex()).getNumero());
        }
        if (checkTipo.isSelected()) {
            cond.add("patri_reg_emprestimo.tipo="+camTipo.getSelectedIndex());
        }
        if (checkTipoEmp.isSelected()) {
            if (camTipoEmp.getSelectedIndex()==0) {
                cond.add("patri_reg_emprestimo.setor_responsavel<>-1");
            } else {
                cond.add("patri_reg_emprestimo.setor_responsavel=-1");
            }
        }
        if (checkPatrimonio.isSelected()) {
            cond.add("patri_patrimonio.orgao="+patrimonio.getOrgao());
            cond.add("patri_patrimonio.area="+patrimonio.getArea());
            cond.add("patri_patrimonio.grupo="+patrimonio.getGrupo());
            cond.add("patri_patrimonio.subgrupo="+patrimonio.getSubgrupo());
            cond.add("patri_patrimonio.numero="+patrimonio.getNumero());
        }
        return cond;
    }

    private String montaSQL() {
        ArrayList<String> cond = getCondicoes();
        String sql = "SELECT patri_reg_emprestimo.bem_orgao as numOrgao, patri_orgao.nome as orgao," +
                            "patri_reg_emprestimo.bem_area as numArea, patri_area.nome as area, "+
                            "patri_reg_emprestimo.bem_grupo as numGrupo, patri_grupo.nome as grupo, "+
                            "patri_reg_emprestimo.bem_subgrupo as numSubgrupo, patri_subgrupo.nome as subgrupo, "+
                            "patri_reg_emprestimo.bem_numero as numPatrimonio, patri_patrimonio.nome as patrimonio, "+
                            "patri_reg_emprestimo.responsavel as responsavel, patri_reg_emprestimo.empresa as empresa, "+
                            "patri_reg_emprestimo.cnpj as cnpj, patri_reg_emprestimo.endereco as endereco, "+
                            "patri_reg_emprestimo.telefone as telefone, "+
                            "CASE patri_reg_emprestimo.tipo WHEN 0 THEN 'Entrada' ELSE 'Saída' END as tipo, "+
                            "patri_reg_emprestimo.data as data, patri_reg_emprestimo.hora as hora, "+
                            "patri_usuario.nome as usuario, patri_reg_emprestimo.obs as obs";
        if (camTipoEmp.getSelectedIndex()==0) {
            sql += ", patri_setor.nome as setorResp";
        } else {
            sql += ", CASE patri_reg_emprestimo.setor_responsavel WHEN -1 THEN 'Não disponível' END as setorResp";
        }
        sql += " FROM patri_reg_emprestimo "+
                "LEFT JOIN patri_orgao ON (patri_reg_emprestimo.bem_orgao=patri_orgao.numero) "+
                "LEFT JOIN patri_area ON (patri_reg_emprestimo.bem_area=patri_area.numero) "+
                "LEFT JOIN patri_grupo ON (patri_reg_emprestimo.bem_grupo=patri_grupo.numero) "+
                "LEFT JOIN patri_subgrupo ON (patri_reg_emprestimo.bem_subgrupo=patri_subgrupo.numero AND patri_reg_emprestimo.bem_grupo=patri_subgrupo.grupo) "+
                "LEFT JOIN patri_patrimonio ON (patri_reg_emprestimo.bem_orgao=patri_patrimonio.orgao AND "+
                "patri_reg_emprestimo.bem_area=patri_patrimonio.area AND "+
                "patri_reg_emprestimo.bem_grupo=patri_patrimonio.grupo AND "+
                "patri_reg_emprestimo.bem_subgrupo=patri_patrimonio.subgrupo AND "+
                "patri_reg_emprestimo.bem_numero=patri_patrimonio.numero) "+
                "LEFT JOIN patri_usuario ON (patri_reg_emprestimo.usuario=patri_usuario.numero) ";
        if (camTipoEmp.getSelectedIndex()==0) {
            sql += "LEFT JOIN patri_setor ON (patri_reg_emprestimo.setor_responsavel=patri_setor.numero) ";
        }
        boolean primeira = false;
        for (int i=0;i<cond.size();i+=1) {
            if (!primeira) {
                sql += " WHERE ";
                primeira = true;
            } else {
                sql += " AND ";
            }
            sql += cond.get(i);
        }
        if (checkData.isSelected()) {
            if (!primeira) {
                sql += " WHERE ";
                primeira = true;
            } else {
                sql += " AND ";
            }
            sql += "patri_reg_emprestimo.data BETWEEN '"+util.dataToStringBarra(camDataInicial.getText(), "-")+"' AND '"+util.dataToStringBarra(camDataFinal.getText(), "-")+"'";
        }
        if (camOrdem.getSelectedIndex()==0) {
            sql += " ORDER BY patri_patrimonio.nome ASC";
        } else {
            sql += " ORDER BY patri_reg_emprestimo.data ASC";
        }
        System.out.println(sql);
        return sql;
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel8 = new javax.swing.JPanel();
        jPanel14 = new javax.swing.JPanel();
        camOrdem = new javax.swing.JComboBox();
        botGerar = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        checkUsuario = new javax.swing.JCheckBox();
        camUsuario = new javax.swing.JComboBox();
        jPanel10 = new javax.swing.JPanel();
        camDataInicial = new CampoMask("##/##/####");
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        camDataFinal = new CampoMask("##/##/####");
        checkData = new javax.swing.JCheckBox();
        jPanel11 = new javax.swing.JPanel();
        checkPatrimonio = new javax.swing.JCheckBox();
        jLabel29 = new javax.swing.JLabel();
        camOrgao = new javax.swing.JComboBox();
        jLabel28 = new javax.swing.JLabel();
        camBuscaArea = new javax.swing.JTextField();
        jLabel25 = new javax.swing.JLabel();
        camBuscaGrupo = new javax.swing.JTextField();
        camBuscaSubgrupo = new javax.swing.JTextField();
        jLabel26 = new javax.swing.JLabel();
        camBuscaNumero = new javax.swing.JTextField();
        jLabel27 = new javax.swing.JLabel();
        botBuscar = new javax.swing.JButton();
        camPatrimonio = new javax.swing.JTextField();
        jPanel7 = new javax.swing.JPanel();
        checkSetorResp = new javax.swing.JCheckBox();
        camSetorResp = new javax.swing.JComboBox();
        jPanel12 = new javax.swing.JPanel();
        checkTipo = new javax.swing.JCheckBox();
        camTipo = new javax.swing.JComboBox();
        jPanel13 = new javax.swing.JPanel();
        checkTipoEmp = new javax.swing.JCheckBox();
        camTipoEmp = new javax.swing.JComboBox();

        setClosable(true);
        setTitle("Relatório de Empréstimos");

        jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Opções", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Segoe UI", 0, 13))); // NOI18N

        jPanel14.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Ordenar Por", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Segoe UI", 0, 13))); // NOI18N

        camOrdem.setFont(new java.awt.Font("Segoe UI", 0, 13));
        camOrdem.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Descrição", "Data" }));

        javax.swing.GroupLayout jPanel14Layout = new javax.swing.GroupLayout(jPanel14);
        jPanel14.setLayout(jPanel14Layout);
        jPanel14Layout.setHorizontalGroup(
            jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel14Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(camOrdem, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel14Layout.setVerticalGroup(
            jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel14Layout.createSequentialGroup()
                .addComponent(camOrdem, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        botGerar.setFont(new java.awt.Font("Segoe UI", 0, 13));
        botGerar.setText("Gerar Relatório");
        botGerar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botGerarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel8Layout.createSequentialGroup()
                .addContainerGap(416, Short.MAX_VALUE)
                .addComponent(jPanel14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(botGerar)
                .addGap(6, 6, 6))
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(botGerar))
                    .addComponent(jPanel14, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Filtros", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Segoe UI", 0, 13))); // NOI18N

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Usuário", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Segoe UI", 0, 13))); // NOI18N

        checkUsuario.setFont(new java.awt.Font("Segoe UI", 0, 13));
        checkUsuario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkUsuarioActionPerformed(evt);
            }
        });

        camUsuario.setFont(new java.awt.Font("Segoe UI", 0, 13));
        camUsuario.setEnabled(false);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(checkUsuario)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(camUsuario, 0, 303, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(checkUsuario)
                    .addComponent(camUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Data", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Segoe UI", 0, 13))); // NOI18N

        camDataInicial.setFont(new java.awt.Font("Segoe UI", 0, 13));
        camDataInicial.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        camDataInicial.setEnabled(false);
        camDataInicial.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                camDataInicialFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                camDataInicialFocusLost(evt);
            }
        });

        jLabel5.setFont(new java.awt.Font("Segoe UI", 0, 13));
        jLabel5.setText("De");

        jLabel6.setFont(new java.awt.Font("Segoe UI", 0, 13));
        jLabel6.setText("à");

        camDataFinal.setFont(new java.awt.Font("Segoe UI", 0, 13));
        camDataFinal.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        camDataFinal.setEnabled(false);
        camDataFinal.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                camDataFinalFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                camDataFinalFocusLost(evt);
            }
        });

        checkData.setFont(new java.awt.Font("Segoe UI", 0, 13));
        checkData.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkDataActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel10Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(checkData)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE)
                .addComponent(jLabel5)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(camDataInicial, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jLabel6)
                .addGap(18, 18, 18)
                .addComponent(camDataFinal, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel10Layout.setVerticalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(camDataFinal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel6)
                        .addComponent(camDataInicial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel5))
                    .addComponent(checkData))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel11.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Patrimônio", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Segoe UI", 0, 13))); // NOI18N

        checkPatrimonio.setFont(new java.awt.Font("Segoe UI", 0, 13));
        checkPatrimonio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkPatrimonioActionPerformed(evt);
            }
        });

        jLabel29.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel29.setText("Órgão");

        camOrgao.setFont(new java.awt.Font("Segoe UI", 0, 13));
        camOrgao.setEnabled(false);

        jLabel28.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel28.setText("Área");

        camBuscaGrupo.setDocument(new Documento(true, 5));
        camBuscaArea.setFont(new java.awt.Font("Segoe UI", 0, 13));
        camBuscaArea.setText("1");
        camBuscaArea.setEnabled(false);
        camBuscaArea.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                camBuscaAreaActionPerformed(evt);
            }
        });

        jLabel25.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel25.setText("Grupo");

        camBuscaGrupo.setDocument(new Documento(true, 5));
        camBuscaGrupo.setFont(new java.awt.Font("Segoe UI", 0, 13));
        camBuscaGrupo.setText("1");
        camBuscaGrupo.setEnabled(false);
        camBuscaGrupo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                camBuscaGrupoActionPerformed(evt);
            }
        });

        camBuscaSubgrupo.setDocument(new Documento(true, 5));
        camBuscaSubgrupo.setFont(new java.awt.Font("Segoe UI", 0, 13));
        camBuscaSubgrupo.setText("3");
        camBuscaSubgrupo.setEnabled(false);
        camBuscaSubgrupo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                camBuscaSubgrupoActionPerformed(evt);
            }
        });

        jLabel26.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel26.setText("Subgrupo");

        camBuscaNumero.setDocument(new Documento(true, 5));
        camBuscaNumero.setFont(new java.awt.Font("Segoe UI", 0, 13));
        camBuscaNumero.setText("18");
        camBuscaNumero.setEnabled(false);
        camBuscaNumero.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                camBuscaNumeroActionPerformed(evt);
            }
        });

        jLabel27.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel27.setText("Número");

        botBuscar.setFont(new java.awt.Font("Segoe UI", 0, 13));
        botBuscar.setText("Buscar");
        botBuscar.setEnabled(false);
        botBuscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botBuscarActionPerformed(evt);
            }
        });

        camBuscaGrupo.setDocument(new Documento(true, 5));
        camPatrimonio.setEditable(false);
        camPatrimonio.setFont(new java.awt.Font("Segoe UI", 0, 13));
        camPatrimonio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                camPatrimonioActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
        jPanel11.setLayout(jPanel11Layout);
        jPanel11Layout.setHorizontalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(checkPatrimonio)
                .addGap(18, 18, 18)
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(camPatrimonio, javax.swing.GroupLayout.DEFAULT_SIZE, 629, Short.MAX_VALUE)
                    .addGroup(jPanel11Layout.createSequentialGroup()
                        .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel29)
                            .addComponent(camOrgao, 0, 286, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(camBuscaArea, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel28))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel25)
                            .addComponent(camBuscaGrupo, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel26)
                            .addComponent(camBuscaSubgrupo, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel11Layout.createSequentialGroup()
                                .addComponent(camBuscaNumero, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(botBuscar))
                            .addComponent(jLabel27))))
                .addContainerGap())
        );
        jPanel11Layout.setVerticalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(checkPatrimonio)
                    .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(jPanel11Layout.createSequentialGroup()
                            .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel27)
                                    .addComponent(jLabel26))
                                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel28)
                                    .addComponent(jLabel25)))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(camBuscaSubgrupo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(camBuscaNumero, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(camBuscaGrupo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(camBuscaArea, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(botBuscar)))
                        .addGroup(jPanel11Layout.createSequentialGroup()
                            .addComponent(jLabel29)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(camOrgao, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(6, 6, 6)
                .addComponent(camPatrimonio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Setor Responsável", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Segoe UI", 0, 13))); // NOI18N

        checkSetorResp.setFont(new java.awt.Font("Segoe UI", 0, 13));
        checkSetorResp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkSetorRespActionPerformed(evt);
            }
        });

        camSetorResp.setFont(new java.awt.Font("Segoe UI", 0, 13));
        camSetorResp.setEnabled(false);

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(checkSetorResp)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(camSetorResp, 0, 303, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(checkSetorResp)
                    .addComponent(camSetorResp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel12.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Tipo", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Segoe UI", 0, 13))); // NOI18N

        checkTipo.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
        checkTipo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkTipoActionPerformed(evt);
            }
        });

        camTipo.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
        camTipo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Voltaram", "Foram" }));
        camTipo.setEnabled(false);

        javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
        jPanel12.setLayout(jPanel12Layout);
        jPanel12Layout.setHorizontalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel12Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(checkTipo)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(camTipo, 0, 116, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel12Layout.setVerticalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel12Layout.createSequentialGroup()
                .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(checkTipo)
                    .addComponent(camTipo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel13.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Tipo de Empréstimo", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Segoe UI", 0, 13))); // NOI18N

        checkTipoEmp.setFont(new java.awt.Font("Segoe UI", 0, 13));
        checkTipoEmp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkTipoEmpActionPerformed(evt);
            }
        });

        camTipoEmp.setFont(new java.awt.Font("Segoe UI", 0, 13));
        camTipoEmp.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Interno", "Externo" }));
        camTipoEmp.setEnabled(false);

        javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13);
        jPanel13.setLayout(jPanel13Layout);
        jPanel13Layout.setHorizontalGroup(
            jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel13Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(checkTipoEmp)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(camTipoEmp, 0, 112, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel13Layout.setVerticalGroup(
            jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel13Layout.createSequentialGroup()
                .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(checkTipoEmp)
                    .addComponent(camTipoEmp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jPanel7, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addComponent(jPanel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
            .addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-732)/2, (screenSize.height-449)/2, 732, 449);
    }// </editor-fold>//GEN-END:initComponents

    private void botGerarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botGerarActionPerformed
        gr.gerarRelatorio(montaSQL(), "relatorio_emprestimo");
}//GEN-LAST:event_botGerarActionPerformed

    private void checkUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkUsuarioActionPerformed
        if (checkUsuario.isSelected()) {
            camUsuario.setEnabled(true);
        } else {
            camUsuario.setEnabled(false);
        }
}//GEN-LAST:event_checkUsuarioActionPerformed

    private void camDataInicialFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_camDataInicialFocusLost

}//GEN-LAST:event_camDataInicialFocusLost

    private void camDataFinalFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_camDataFinalFocusLost
        // TODO add your handling code here:
}//GEN-LAST:event_camDataFinalFocusLost

    private void checkDataActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkDataActionPerformed
        if (checkData.isSelected()) {
            camDataInicial.setEnabled(true);
            camDataFinal.setEnabled(true);
            camDataInicial.requestFocus();
        } else {
            camDataInicial.setEnabled(false);
            camDataFinal.setEnabled(false);
        }
}//GEN-LAST:event_checkDataActionPerformed

    private void checkPatrimonioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkPatrimonioActionPerformed
        if (checkPatrimonio.isSelected()) {
            camOrgao.setEnabled(true);
            camBuscaArea.setEnabled(true);
            camBuscaGrupo.setEnabled(true);
            camBuscaSubgrupo.setEnabled(true);
            camBuscaNumero.setEnabled(true);
            botBuscar.setEnabled(true);
        } else {
            camOrgao.setEnabled(false);
            camBuscaArea.setEnabled(false);
            camBuscaGrupo.setEnabled(false);
            camBuscaSubgrupo.setEnabled(false);
            camBuscaNumero.setEnabled(false);
            botBuscar.setEnabled(false);
        }
}//GEN-LAST:event_checkPatrimonioActionPerformed

    private void camBuscaAreaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_camBuscaAreaActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_camBuscaAreaActionPerformed

    private void camBuscaGrupoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_camBuscaGrupoActionPerformed

}//GEN-LAST:event_camBuscaGrupoActionPerformed

    private void camBuscaSubgrupoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_camBuscaSubgrupoActionPerformed

}//GEN-LAST:event_camBuscaSubgrupoActionPerformed

    private void camBuscaNumeroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_camBuscaNumeroActionPerformed

}//GEN-LAST:event_camBuscaNumeroActionPerformed

    private void botBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botBuscarActionPerformed
        buscarPatrimonio();
}//GEN-LAST:event_botBuscarActionPerformed

    private void camPatrimonioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_camPatrimonioActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_camPatrimonioActionPerformed

    private void checkSetorRespActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkSetorRespActionPerformed
        if (checkSetorResp.isSelected()) {
            camSetorResp.setEnabled(true);
        } else {
            camSetorResp.setEnabled(false);
        }
}//GEN-LAST:event_checkSetorRespActionPerformed

    private void checkTipoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkTipoActionPerformed
        if (checkTipo.isSelected()) {
            camTipo.setEnabled(true);
        } else {
            camTipo.setEnabled(false);
        }
}//GEN-LAST:event_checkTipoActionPerformed

    private void checkTipoEmpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkTipoEmpActionPerformed
        if (checkTipoEmp.isSelected()) {
            camTipoEmp.setEnabled(true);
        } else {
            camTipoEmp.setEnabled(false);
        }
}//GEN-LAST:event_checkTipoEmpActionPerformed

    private void camDataInicialFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_camDataInicialFocusGained
        camDataInicial.selectAll();
    }//GEN-LAST:event_camDataInicialFocusGained

    private void camDataFinalFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_camDataFinalFocusGained
        camDataFinal.selectAll();
    }//GEN-LAST:event_camDataFinalFocusGained


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton botBuscar;
    private javax.swing.JButton botGerar;
    private javax.swing.JTextField camBuscaArea;
    private javax.swing.JTextField camBuscaGrupo;
    private javax.swing.JTextField camBuscaNumero;
    private javax.swing.JTextField camBuscaSubgrupo;
    private javax.swing.JTextField camDataFinal;
    private javax.swing.JTextField camDataInicial;
    private javax.swing.JComboBox camOrdem;
    private javax.swing.JComboBox camOrgao;
    private javax.swing.JTextField camPatrimonio;
    private javax.swing.JComboBox camSetorResp;
    private javax.swing.JComboBox camTipo;
    private javax.swing.JComboBox camTipoEmp;
    private javax.swing.JComboBox camUsuario;
    private javax.swing.JCheckBox checkData;
    private javax.swing.JCheckBox checkPatrimonio;
    private javax.swing.JCheckBox checkSetorResp;
    private javax.swing.JCheckBox checkTipo;
    private javax.swing.JCheckBox checkTipoEmp;
    private javax.swing.JCheckBox checkUsuario;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel13;
    private javax.swing.JPanel jPanel14;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    // End of variables declaration//GEN-END:variables

}
